<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">流量池使用量</a></li>
    </ul>

    <form class="js-ajax-form" action="" method="post">

        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <td>当月可用</td>
                <td>当月已用</td>
                <td>剩余量</td>
            </tr>
            </thead>
                <tr>
                    <td>{$pool.pool_total}M</td>
                    <td>{$pool.pool_already}M</td>
                    <td>{$pool.pool_left}M</td>
                </tr>

        </table>

    </form>
    <form class="well form-search" method="post" action="{:U('AdminFlow/month')}">
        ICCID：
        <input type="text" name="s_number" style="width: 200px;" value="{$s_number}" placeholder="请输入卡号">
        日期：
        <select name="s_date">
            <option <if condition="$s_date !=2">selected</if> value="1">本月</option>
            <option <if condition="$s_date == 2">selected</if> value="2">上月</option>
        </select> &nbsp;&nbsp;

        <input type="submit" class="btn btn-primary" onclick="javascript:ajax_get_list(1);return false;" value="搜索" />
    </form>
    <form class="js-ajax-form" action="" method="post">

        <table class="table table-hover table-bordered table-list" id="table-list">
            <thead>
            <tr>
                <td>ICCID</td>
                <td>成员号码</td>
                <td>成员分配额度</td>
                <td>成员支出量值</td>
                <td>池剩余量</td>
            </tr>
            </thead>
            <!--<foreach name="list" item="vo">-->
            <!--<tr>-->
                <!--<td>{$vo.card_iccid}</td>-->
                <!--<td>{$vo.ACC_NBR}</td>-->
                <!--<td>{$vo.POOL_MEMBER_TOTAL}</td>-->
                <!--<td>{$vo.POOL_MEMBER_ALREADY}</td>-->
                <!--<td>{$vo.pool_left}</td>-->
            <!--</tr>-->
        <!--</foreach>-->
        </table>
        <div class="loading">
            <img src="__PUBLIC__/images/loading.gif" />
        </div>
        <div class="pagination"></div>
        <div style="float: right">
            <a  href="{:U('Download/current',array('type'=>'flow_month'))}" class="btn btn-primary">下载当前</a>&nbsp;&nbsp;
            <a  href="{:U('Download/all',array('type'=>'flow_month','s_date'=>$s_date,'s_number'=>$s_number))}" class="btn btn-primary" onclick="javascript:return confirm_download();">下载全部</a>
        </div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    function refersh_window() {
        var refersh_time = getCookie('refersh_time');
        if (refersh_time == 1) {
            window.location = "{:U('AdminPost/index',$formget)}";
        }
    }
    $(function(){
        $(".loading").hide();
    });

    function ajax_get_list(p){
        $(".tr-data").remove();
        $(".loading").show();
        var s_number = $("input[name='s_number']").val();
        var s_date = $("select[name='s_date']").val();
        if( p == '' || isNaN(p)){
            p = 1;
        }
        $.ajax({
            url:"{:U('AdminFlow/month')}",
            async:true,
            dataType:"json",
            data:"s_number="+s_number+"&s_date="+s_date+"&p="+p,
            success:function(t){
                if(t.code == 0){
                    if(t.checkCard != ''){
                        alert(t.checkCard);
                    }
                    var content;
                    var d_length = t.data.length;
                    for(var i=0;i<d_length;i++){
                        var temp = t.data[i];
                        content = content+'<tr class="tr-data">'+
                                '<td>'+temp.card_iccid+'</td>'+
                                '<td>'+temp.ACC_NBR+'</td>'+
                                '<td>'+temp.POOL_MEMBER_TOTAL+'</td>'+
                                '<td>'+temp.POOL_MEMBER_ALREADY+'</td>'+
                                '<td>'+temp.pool_left+'</td>'+
                                ' </tr>';
                    }
                    $(".loading").hide();
                    $("#table-list").append(content);
                    $(".pagination").html(t.page);

                }else{
                    alert("数据读取失败")
                }
            }
        });
    }
</script>
</body>
</html>